/*
Copyright Inspur Corp. 2022-2022 All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package inode

// Name implements the platforms.NameDescriber interface
func (cs *ContractSpec) Name() string {
	if cs.ContractId == nil {
		return ""
	}

	return cs.ContractId.Name
}

func (cs *ContractSpec) Version() string {
	if cs.ContractId == nil {
		return ""
	}

	return cs.ContractId.Version
}

// Path implements the platforms.PathDescriber interface
func (cs *ContractSpec) Path() string {
	if cs.ContractId == nil {
		return ""
	}

	return cs.ContractId.Path
}

func (cs *ContractSpec) ContractType() string {
	return cs.Type.String()
}

// Path implements the platforms.PathDescriber interface
func (cds *ContractDeploymentSpec) Path() string {
	if cds.ContractSpec == nil {
		return ""
	}

	return cds.ContractSpec.Path()
}

// Bytes implements the platforms.CodePackage interface
func (cds *ContractDeploymentSpec) Bytes() []byte {
	return cds.CodePackage
}

func (cds *ContractDeploymentSpec) ContractType() string {
	if cds.ContractSpec == nil {
		return ""
	}

	return cds.ContractSpec.ContractType()
}

func (cds *ContractDeploymentSpec) Name() string {
	if cds.ContractSpec == nil {
		return ""
	}

	return cds.ContractSpec.Name()
}

func (cds *ContractDeploymentSpec) Version() string {
	if cds.ContractSpec == nil {
		return ""
	}

	return cds.ContractSpec.Version()
}
